<template>
	<view class="small-search" @tap="search">
		<icon class="icon-search"></icon>
		<input 
		type="text" 
		class="search-input" 
		:placeholder="placeholder" 
		:disabled="disabled" 
		:value="value"
		placeholder-style="color:#999999;font-size:28rpx"
		@confirm="confirm"
		>
	</view>
</template>

<script>
	export default {
		props:{
			placeholder:{
				type:String,
				default:'搜索关键字'
			},
			disabled:{
				type:Boolean,
				default:false
			},
			value:{
				type:String,
				default:''
			}
		},
		data() {
			return {
			}
		},
		methods: {
			search:function(){
				this.$emit('search')
			},
			confirm:function(e){
				this.$emit('confirm',e.detail.value)
			},
		}
	}
</script>

<style scoped lang="scss">
	.small-search{
		width: 100%;
		height: 60rpx;
		background: #FFFFFF;
		border-radius: 30rpx;
		border: 1rpx solid #E9E9E9;
		padding: 0 18rpx;
		box-sizing: border-box;
		display: flex;
		align-items: center;
		.icon-search{
			width: 30rpx;
			height: 30rpx;
			background: url(../../static/images/search.png) no-repeat;
			background-size: cover;
			margin-right: 14rpx;
		}
		.search-input{
			flex: 1;
			height: 100%;
			font-size: 28rpx;
		}
	}
</style>
